package com.blog.controller;

import com.blog.common.CommonRespDto;
import com.blog.common.RespBean;
import com.blog.service.XaaaaaaBaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName XaaaaaaBaseController
 * @Destription Xaaaaaa基础：增删改查
 * @Author 天堂小野花
 * @Date 2025/8/19  19:16
 * @Version 1.0
 */
@RestController
@RequestMapping("/xaaaaaa")
public class XaaaaaaBaseController {
    @Autowired
    XaaaaaaBaseService xaaaaaaBaseService;
    @GetMapping("/base/selectXaaaaaaById/{rid}")
    public CommonRespDto selectXaaaaaaById(@PathVariable Integer rid){
        return CommonRespDto.success(xaaaaaaBaseService.selectXaaaaaaById(rid.longValue()));
    }

    @PostMapping("/base/insertXaaaaaa")
    public RespBean insertXaaaaaa(@RequestBody Xaaaaaa xaaaaaa){
        if(xaaaaaaBaseService.insertXaaaaaa(xaaaaaa) == 1 ){
            return RespBean.ok("添加成功");
        }
        return RespBean.error("添加失败");
    }
    @DeleteMapping("/base/deleteXaaaaaa/{rid}")
    public RespBean deleteXaaaaaaById(@PathVariable Integer rid){
        if(xaaaaaaBaseService.deleteXaaaaaaById(rid.longValue()) == 1){
            return RespBean.ok("删除成功");
        }
        return RespBean.error("删除失败");
    }
    @PutMapping("/base/updateXaaaaaa")
    public RespBean updateXaaaaaa(@RequestBody Xaaaaaa xaaaaaa){

        if(xaaaaaaBaseService.updateXaaaaaa(xaaaaaa) == 1){
            return RespBean.ok("更新成功");
        }
        return RespBean.error("更新失败");
    }
}
